﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace WizzardTheGame
{
    class Weapon:Equipment
    {
        private bool attacking;
        private const Int32 START_ATTACK_TICS = 20;
        private Int32 attacktics;

        #region Properties

        public bool Attacking
        {
            get { return attacking; }
            set { attacking = value; }
        }

        private Int32 Attacktics
        {
            get { return attacktics; }
            set { attacktics = value; }
        }

        #endregion

        public Weapon():base()
        {
            Attacking = false;
            Attacktics = 0;
        }

        public void Attack()
        {
            if (!Attacking)
            {
                Attacking = true;
                IsVisible = true;
                Attacktics = START_ATTACK_TICS;
            }
        }

        public void Update()
        {
            if (Attacking)
            {
                ItemModel.Rotation += new Vector3(1f, 0f, 0f);

                Attacktics--;
                if (Attacktics == 0) Attacking = false;
            }
        }

        public override void Draw()
        {
            if(Attacking) base.Draw();
        }
    }
}
